#ifndef _WINDOW_H_
#define _WINDOW_H_

#include <SDL.h>
#include <Gwen/BaseRender.h>
#include <Gwen/TextObject.h>
#include <Gwen/Skins/TexturedBase.h>

#include "Vector2i.h"

namespace PF
{
	class Window
	{
	public:
		Window();
		virtual ~Window();

		bool Create(const char *a_szTitle, int a_iX, int a_iY,int a_iW, int a_iH, Uint32 a_uiFlags);
	
		void Clear(Uint8 a_uiR, Uint8 a_uiG, Uint8 a_uiB, Uint8 a_uiA);

		void Update(float a_fDeltaTime);
		void Render();

		void OnEvent(SDL_Event *a_pEvent);
		void OnKeyboardEvent(SDL_KeyboardEvent *a_pEvent);
		void OnMouseMotionEvent(SDL_MouseMotionEvent *a_pEvent);
		void OnMouseButtonEvent(SDL_MouseButtonEvent *a_pEvent);
		void OnMouseWheelEvent(SDL_MouseWheelEvent *a_pEvent);
		void OnTextInputEvent(SDL_TextInputEvent *a_pEvent);

		SDL_Window *GetHandle();
		SDL_GLContext GetContext();

		Gwen::Renderer::Base *GetRenderer();
		void SetSkin(const Gwen::TextObject &a_kTextureName);
		Gwen::Controls::Canvas *GetCanvas();

		Uint32 GetFlags();

		PF::Vector2i GetPosition();
		void SetPosition(int a_iX, int a_iY);

		PF::Vector2i GetSize();
		void SetSize(int a_iW, int a_iH);

		const char *GetTitle();
		void SetTitle(const char *a_szTitle);

		bool GetFullscreen();
		void SetFullscreen(bool a_bFullscreen);

	protected:
		SDL_Window *m_pWindow;
		SDL_GLContext m_pContext;

		Gwen::Renderer::Base *m_pRenderer;
		Gwen::Skin::TexturedBase *m_pSkin;
		Gwen::Controls::Canvas *m_pCanvas;

		bool m_bFullscreen;
	};
}

#endif // _WINDOW_H_
